)); % similar to the output format of the C languageEndfprintf (FID, ' \ n ');Endfprintf (FID, ' This ISA string\n ');fprintf (FID, '%x ', Hex2dec (' ABCD '));Fclose (FID); % finally don't forget to close the file!The Test.txt file will be generated in the current working directory of MATLABRead from File:we can use fscanf functionfscanf :% plus T for the same reason as aboveFid=fopen (' d:\test.txt ', ' RT ');% to read the data. Where data is the matrix of 2*3DATA=FSCANF (FID, '%d ', [2, 3]);S=
Print, fprint, fscanf, and disp functions of MATLAB
Print:
The print function can save the function image as an image:
Minbnd =-4 * PI; maxbnd = 4 * PI; t = minbnd: 0.1 * Pi: maxbnd; plot (T, sin (t), 'G', 'linewidth ', 2); line ([minbnd, maxbnd], [0, 0]); % draw the X axis ([-10, 10,-2, 2]) % defines the displayed coordinate range: X Between (-10, 10), y between (-2, 2) grid between '); % Save As PNG image, in the current working director
int num = 12345;Store 12345 as a binary number in num1.fprintf (FP, "%d", num); Write the binary code of the character ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ' into the file2.Fwrite (num, sizeof (int), n, FP); The binary code of Value 12345 is written to the file, the data is divided into n blocks, each block is an int size,
FP specifies the file to write to.
num Memory storage address for read-in file data
Fread () is the same as the parameter of the fwrite () function. (By using the fread
other auxiliary tools to search and filter, it is not enough to use the display screen to output debugging information, at this time, we often output this information to the so-called log file, and then carefully analyze the log file to find the problem.
ØUse shell I/O redirection
The simple log writing method can be implemented through the shell I/O redirection mechanism, for example, the following code:
1 # include 23 int main ()4 {5 fprintf (stdout, "This is a standard output info!
information is large and requires some time or other auxiliary tools to search and filter, it is not enough to use the display screen to output debugging information, at this time, we often output this information to the so-called log file, and then carefully analyze the log file to find the problem. ØUse shell I/O redirectionThe simple log writing method can be implemented through the shell I/O redirection mechanism, for example, the following code:
1 # include 2 3 int main () 4 {5 fp
especially strong for me who often experiment with various deb packages, wander around the Ubuntu Software Center, and often use sudo. However, this fingerprint recognition has become a task this morning.
The whole process is not complicated, but because Cannonical and Ubuntu Software Center do not support this, it is still necessary to make a little effort. The process is as follows:Add PPA software sourceCommand Line sudo add-apt-repository ppa: fingerprint/
On Ubuntu, you can install fprint-demo and fingerprint-gui as the fingerprint recognition software for ThinkPad. I tried fprint-demo, which can be used with the Ubuntu SYSTEM account, but the recognition effect is poor. Fingerprint-gui runs as an independent fingerprint software, and the recognition effect is good. Therefore, fingerprint-gui is used. Installation Method on Ubuntu14.10 1. Add PPA # sudo
On U
thank David Jurenka, the hero behind the scenes, for saving us so much time.
Open System> Administration> Software Sources and add the following under the Other Software tab:
Ppa: fingerprint/fprint
Reload the Software List as prompted.
2. Install and test the FPrint fingerprint recognition software
Open Applications> Ubuntu Software Center, search for fprint-de
scan functions, if the parameter contains the scan method (or implements the dig Interface), this parameter will be used to read text. In addition, if the number of parameters filled in is less than the number of provided parameters, an error is returned.
All parameters to be input should be basic type or data type pointers that implement the callback interface.
Note: fscan and other functions can read and return the required characters from the input, which means that a circular reader may ski
Interesting example of Python decorator
Miss Liao's tutorial is too advanced to understand. Click to open the link.
def deco_functionNeedDoc(func): if func.__doc__ == None : print func, "has no __doc__, it's a bad habit." else: print func, ':', func.__doc__, '.' return func@deco_functionNeedDocdef f(): print 'f() Do something'@deco_functionNeedDocdef g(): 'I have a __doc__' print 'g() Do something'f()g()print fprint g
Teacher Liao's tutorial is too advanced, do not understand, click to open the linkdef deco_functionneeddoc (func): if func.__doc__ = = None: print func, "has no __doc__, it's a bad habit." else: print func, ': ', func.__doc__, '. ' return func@deco_functionneeddocdef F (): print ' F () do something ' @deco_functionNeedDocdef g (): ' I had a __doc_ _ ' print ' g () do something ' F () g () Print Fprint gThis code prints
Install fingerprint identification on ThinkPad X220 Ubuntu 14.10
On Ubuntu, you can install fprint-demo and fingerprint-gui as the fingerprint recognition software for ThinkPad. I tried fprint-demo, which can be used with the Ubuntu SYSTEM account, but the recognition effect is poor.
Fingerprint-gui runs as an independent fingerprint software, and the recognition effect is good. Therefore, fingerprint-gui
An interesting example of Python decorators and an exploration of python decorations
Miss Liao's tutorial is too advanced to understand. Click to open the link.
def deco_functionNeedDoc(func): if func.__doc__ == None : print func, "has no __doc__, it's a bad habit." else: print func, ':', func.__doc__, '.' return func@deco_functionNeedDocdef f(): print 'f() Do something'@deco_functionNeedDocdef g(): 'I have a __doc__' print 'g() Do something'f()g()print
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.